<?php


namespace App\Http\Controllers\Api;
use Aoxiang\Pca\ProvinceCityArea;
use App\Http\Controllers\BaseController;
use Illuminate\Http\Request;

class ProvinceController extends BaseController
{

    public function getProvinceList()
    {
        $list = ProvinceCityArea::getAllProvince();
        return $this->success($list);
    }

    public function getCity(Request $request)
    {
        $this->validate($request, [
            'province_id'
        ]);
        $province_id = $request->input('province_id');
        return $this->success(ProvinceCityArea::getCityList($province_id));
    }

    public function getArea(Request $request)
    {
        $this->validate($request, [
            'city_id'
        ]);
        $city_id = $request->input('city_id');
        return $this->success(ProvinceCityArea::getAreaList($city_id));
    }

}

